package com.cambright.mixpaint
{
	public class Block extends Graphic
	{
		private var _graphicChanged:Boolean = true;
		
		private var _round:int = 0;
		public function get round():int
		{
			return _round;
		}
		public function set round(value:int):void
		{
			if(value < 0) value = 0;
			if(value == _round) return;
			_round = value;
			_graphicChanged = true;
		}
		
		override protected function get isChanged():Boolean
		{
			var isChanged:Boolean = super.isChanged;
			isChanged ||= _graphicChanged;
			return isChanged;
		}
		
		override protected function draw():void
		{
			graphics.clear();
			graphics.beginFill(color, alpha);
			
			if(_round > 0) graphics.drawRoundRect(0, 0, width, height, _round);
			else graphics.drawRect(0, 0, width, height);
			
			graphics.endFill();
		}
		
		override protected function finish():void
		{
			_graphicChanged = false;
		}
	}
}